$.ajax({
  type: "get",
  url: "../json/banner.json",
  dataType: "json",
  success(data) {
    let str = "";
    data.forEach((list) => {
      str += `
      <div class="swiper-slide">
        <img src="${list.url}" alt="">
      </div>
      `
    })
    $(".banner .swiper-wrapper").html(str);
    new Swiper('.banner', {
      loop: true, // 循环模式选项
      autoplay: {
        delay: 2000,//5秒切换一次
      },
      observer: true,
      observeParents: true,
      pagination: {
        el: '.swiper-pagination',
      },
    })
  }
})


var mySwiper = new Swiper('.first-screen-news .swiper-container', {
  direction: 'vertical', // 垂直切换选项
  loop: true, // 循环模式选项
  autoplay: true

})
// prolist部分
$.ajax({
  type: "get",
  url: "../json/homeProlist.json",
  dataType: "json",
  success(data) {
    let str = "";
    data.forEach((item)=>{
      str += `
        <div class="proitem">
          <div class="pic">
            <a href="javascript:;">
              <img src="${item.src}" alt="">
            </a>
          </div>   
          <div class="info">
            <div class="info-wrap">
              <p class="name">
                <a href="javascript:;">
                ${item.title}
                </a>
              </p>
              <p class="sub">
                ${item.saletip ? '<span class="saletip">'+ item.saletip +'</span>' : ''}
               
              </p>
            </div>
            <div class="price">
              <strong>
                 ${item.price}
                </strong>
               / ${item.priceIndex}
              <i class="iconfont icon-gouwuche"></i>
            </div>
          </div>
        </div>
  
      `
    })
    $(".proList-in").html(str);
  }
})
